package com.storeapp;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;

import com.storeapp.ui.CustomerEditView;
import com.storeapp.ui.CustomerList;
import com.storeapp.ui.ItemEditView;
import com.storeapp.ui.ItemsTable;
import com.storeapp.ui.OrderList;
import com.storeapp.ui.ProductEditView;
import com.storeapp.ui.ProductList;

public class Perspective implements IPerspectiveFactory {

	/**
	 * The ID of the perspective as specified in the extension.
	 */
	public static final String ID = "com.storeapp.perspective";

	public void createInitialLayout(IPageLayout layout) {
		//create graphic layout
		String editorArea = layout.getEditorArea();
		layout.setEditorAreaVisible(false);
		
		IFolderLayout folderLeft = layout.createFolder("left", IPageLayout.LEFT, 0.25f, editorArea);
		folderLeft.addView(OrderList.ID);
		folderLeft.addView(ProductList.ID);
		folderLeft.addView(CustomerList.ID);

		IFolderLayout mainfolder = layout.createFolder("main", IPageLayout.TOP, 0.5f, editorArea);
		mainfolder.addPlaceholder(ItemsTable.ID + ":*");
		mainfolder.addPlaceholder(ProductEditView.ID);
		mainfolder.addPlaceholder(CustomerEditView.ID);
		mainfolder.addView(ItemsTable.ID);
		
		IFolderLayout bottomfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.5f, editorArea);
		bottomfolder.addPlaceholder(ItemEditView.ID);
		
		layout.getViewLayout(OrderList.ID).setCloseable(false);
		layout.getViewLayout(ProductList.ID).setCloseable(false);
		layout.getViewLayout(ItemsTable.ID).setCloseable(false);
		layout.getViewLayout(CustomerList.ID).setCloseable(false);
		
	}
}
